const mixins = {
  data () {
    return {
      normalizer(node){
        return node.children&&node.children.length>0?{id:node.id,label:node.name, children:node.children}:{id:node.id,label:node.name}
      }
    }
  },
  methods: {
    leafNoChildren(array){
      if(array&&array.length>0){
          for(let i=0;i<array.length; i++){
              if(array[i].children&&array[i].children.length>0){
                  this.leafNoChildren(array[i].children);
              }else{
                  let obj = {id:array[i].id,name:array[i].name};
                  array[i] = obj;
              }
          }
      }
      return array;
    }
  }
}
export default mixins
